package com.gorkr.cronback.pattern.designPattern.adapter;

/**
 * @author gorkr
 * @title: LongTimeAdapter
 * @projectName cron
 * @description: TODO
 * @date 2021/12/811:39
 */
public class LongTimeAdapter implements LongTime {

    private final CalendarTime calendarTime;

    public LongTimeAdapter(CalendarTime calendarTime) {
        this.calendarTime = calendarTime;
    }

    @Override
    public long getStart() {
        System.out.println("将calendarTime适配为longtime,并调用getStart()");
        return calendarTime.getCalendarStart().getTimeInMillis();

    }

    @Override
    public long getEnd() {
        System.out.println("将calendarTime适配为longtime,并调用getEnd()");
        return calendarTime.getCalendarEnd().getTimeInMillis();
    }
}
